<?php

class Core_Backend_Component_Resource_View_Subject_Index extends Core_Backend_Share_View_Grid {

    protected function buildGrid($grid) {
        $grid->setId('content_grid')
                ->setPrimaryKey('id');
        $grid->addLabelColumn($this->__('share.label.name'), 'name', '{name}')
                ->setWidth(200);
        $grid->addLabelColumn($this->__('share.label.tag'), 'tag', '{tag}');
        if($this->getIdentity()->isAllowAction('resource_subject_assign_road')){
	        $grid->addLinkColumn('#', 'assign_road', $this->getUrl(array('subjectid' => '{id}'), 'road-list'), $this->__('resource.button.assign_road'))
	                ->setWidth(80)
	                ->setAlign('center');
        }
        if($this->getIdentity()->isAllowAction('resource_subject_assign_industry')){
	        $grid->addLinkColumn('#', 'assign_industry', $this->getUrl(array('subjectid' => '{id}'), 'industry-list'), $this->__('resource.button.assign_industry'))
	                ->setWidth(80)
	                ->setAlign('center');
        }
        if($this->getIdentity()->isAllowAction('resource_subject_assign_poi')){
	        $grid->addLinkColumn('#', 'assign_poi', $this->getUrl(array('subjectid' => '{id}'), 'poi-list'), $this->__('resource.button.assign_poi'))
	                ->setWidth(80)
	                ->setAlign('center');
        }
        $grid->setDataSource($this->getList()->toArray());
        parent::buildGrid($grid);
    }
}